<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 基本表单</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="../favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">

                <div class="ibox-content">
                    <form method="post" class="form-horizontal" onsubmit="return false">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">*发送内容</label>
                            <div class="col-sm-10">
                                <textarea placeholder="请此处填写消息" id="text_msg" style="width: 100%;height: 120px">

                                </textarea>
                                <!--<input type="text" name="title" id="merchant_belong"  placeholder="用户名" class="form-control"><br>-->
                            </div>
                        </div>

                        <!--<div class="form-group">-->
                            <!--<label class="col-sm-2 control-label">*三位编码</label>-->
                            <!--<div class="col-sm-10">-->
                                <!--<input type="number" name="title" id="rule_code"  placeholder="" class="form-control"><br>-->
                                <!--<span id="input_warning"> </span>-->
                            <!--</div>-->
                        <!--</div>-->

                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="button" onclick="add()">添加</button>
                            </div>
                        </div>

                    </form>

                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
<script>

    //添加
    function add() {
        var index = layer.load(1, {
            shade: [0.1, '#fff'] //0.1透明度的白色背景
        });
        var url = "__MODULE__/Message/add_msg";

        var text_msg = $("#text_msg").val();
//        var rule_code=$("#rule_code").val();


        if (text_msg == ""  || text_msg ==null ) {
            layer.close(index);
            layer.alert("请信息填写完整！\r\n", {
                title: '提示框',
                icon: 0,
            });
            return false;
        }

        $.post(url, {content:text_msg}, function (data) {
            if (data.code == "1001") {
                layer.alert('添加成功', {title: '提示框', icon: 1}, function (index) {
                    window.parent.location.reload();
                    var index1 = parent.layer.getFrameIndex(window.name);
                    parent.layer.close(index1);

                });
            }
            else {
                layer.alert(data.result, {title: '提示框', icon: 1});
                layer.close(index);
            }
        });
    }

</script>
</body>
</html>
